﻿using System;
using NHibernate;
using MSP.Data.NHibernate.Session;

namespace MSP.Data.NHibernate
{
	public class ActiveSessionManager : IActiveSessionManager
	{
		[ThreadStatic] private static ISession _current;

		public ISession GetActiveSession()
		{
			return _current;
		}

		public void SetActiveSession(ISession session)
		{
			_current = session;
		}

		public void ClearActiveSession()
		{
			_current = null;
		}
	}
}